/**
 * 
 */

$(function() {
	var Page = (function() {

		var $navArrows = $('#nav-arrows').hide(), $navDots = $('#nav-dots')
				.hide(), $nav = $navDots.children('span'), slicebox = $('#sb-slider').slicebox({
			onReady : function() {

				$navArrows.show();
				$navDots.show();
			//	$shadow.show();
			//  $shadow = $('#shadow').hide(),
			},
			onBeforeChange : function(pos) {

				$nav.removeClass('nav-dot-current');
				$nav.eq(pos).addClass('nav-dot-current');

			},
			autoplay : true,
			interval : 10000

		}),

		init = function() {

			initEvents();

		}, initEvents = function() {

			// add navigation events
			$navArrows.children(':first').on('click', function() {

				slicebox.next();
				return false;

			});

			$navArrows.children(':last').on('click', function() {

				slicebox.previous();
				return false;

			});

			$nav.each(function(i) {

				$(this).on('click', function(event) {

					var $dot = $(this);

					if (!slicebox.isActive()) {

						$nav.removeClass('nav-dot-current');
						$dot.addClass('nav-dot-current');

					}

					slicebox.jump(i + 1);
					return false;

				});

			});

		};

		return {
			init : init
		};

	})();
	Page.init();


});